package acme.routing.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.List;

import ws.tracking.Vehicle;

public class RoutingEngineConnector
{
  
  private RoutingEngineImpl engine = new RoutingEngineImpl();
  
  public void doRouteCalculation(String filename) throws Exception
  {
    RouteParser.ParseResult result = RouteParser.parse(new FileInputStream(filename));
    List<Vehicle> newRoutes = engine.computeAllRoutes(result.routes, result.newOrders);
    File f = new File(filename + "_result");
    RouteParser.createXml(newRoutes, new FileOutputStream(f));
  }

}
